package com.bi.common;

import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * 响应状态码枚举
 * 
 * @author BI Platform Team
 * @since 1.0.0
 */
@Getter
@AllArgsConstructor
public enum ResultCode {

    // 成功
    SUCCESS(200, "操作成功"),

    // 客户端错误
    BAD_REQUEST(400, "请求参数错误"),
    UNAUTHORIZED(401, "未授权"),
    FORBIDDEN(403, "禁止访问"),
    NOT_FOUND(404, "资源不存在"),
    METHOD_NOT_ALLOWED(405, "请求方法不被允许"),
    CONFLICT(409, "资源冲突"),
    UNSUPPORTED_MEDIA_TYPE(415, "不支持的媒体类型"),
    VALIDATION_FAILED(422, "参数验证失败"),

    // 服务器错误
    INTERNAL_SERVER_ERROR(500, "内部服务器错误"),
    SERVICE_UNAVAILABLE(503, "服务不可用"),

    // 业务错误码 (6000-6999)
    // 用户相关 (6000-6099)
    USER_NOT_FOUND(6000, "用户不存在"),
    USER_DISABLED(6001, "用户已被禁用"),
    PASSWORD_ERROR(6002, "密码错误"),
    LOGIN_EXPIRED(6003, "登录已过期"),

    // 数据宽表相关 (6100-6199)
    WIDE_TABLE_NOT_FOUND(6100, "数据宽表不存在"),
    WIDE_TABLE_FIELD_INVALID(6101, "宽表字段配置无效"),
    WIDE_TABLE_DATA_EMPTY(6102, "宽表数据为空"),
    EXCEL_IMPORT_FAILED(6103, "Excel导入失败"),
    EXCEL_FORMAT_ERROR(6104, "Excel格式错误"),

    // 组件相关 (6200-6299)
    COMPONENT_NOT_FOUND(6200, "组件不存在"),
    COMPONENT_VERSION_CONFLICT(6201, "组件版本冲突"),
    COMPONENT_CONFIG_INVALID(6202, "组件配置无效"),
    COMPONENT_TEMPLATE_NOT_FOUND(6203, "组件模板不存在"),

    // 图表相关 (6300-6399)
    CHART_CONFIG_INVALID(6300, "图表配置无效"),
    CHART_DATA_PROCESSING_ERROR(6301, "图表数据处理错误"),
    PIVOT_TABLE_CONFIG_ERROR(6302, "透视表配置错误"),

    // 主题场景相关 (6400-6499)
    THEME_SCENARIO_NOT_FOUND(6400, "主题场景不存在"),
    THEME_TEMPLATE_NOT_FOUND(6401, "主题模板不存在"),
    THEME_CONFIG_INVALID(6402, "主题配置无效"),

    // 审批相关 (6500-6599)
    APPROVAL_PROCESS_NOT_FOUND(6500, "审批流程不存在"),
    APPROVAL_STATUS_INVALID(6501, "审批状态无效"),
    WORKFLOW_ENGINE_ERROR(6502, "工作流引擎错误"),

    // 文件相关 (6600-6699)
    FILE_UPLOAD_FAILED(6600, "文件上传失败"),
    FILE_TYPE_NOT_SUPPORTED(6601, "不支持的文件类型"),
    FILE_SIZE_EXCEEDED(6602, "文件大小超出限制"),
    FILE_NOT_FOUND(6603, "文件不存在"),

    // Elasticsearch相关 (6700-6799)
    ES_QUERY_ERROR(6700, "Elasticsearch查询错误"),
    ES_INDEX_NOT_FOUND(6701, "Elasticsearch索引不存在"),
    ES_CONNECTION_ERROR(6702, "Elasticsearch连接错误"),

    // 缓存相关 (6800-6899)
    CACHE_ERROR(6800, "缓存错误"),
    REDIS_CONNECTION_ERROR(6801, "Redis连接错误");

    /**
     * 状态码
     */
    private final Integer code;

    /**
     * 状态消息
     */
    private final String message;
}